home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C & C++ Multimedia Cyber Classroom
/
C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso
/
cpphtp2
/
code.jar
/
code
/
ch03
/
fig03_03.txt
next >
Wrap
Text File
|
1998-02-27
|
427b
|
21 lines
1 // Fig. 3.3: fig03_03.cpp
2 // Creating and using a programmer-defined function
3 #include <iostream.h>
4
5 int square( int ); // function prototype
6
7 int main()
8 {
9 for ( int x = 1; x <= 10; x++ )
10 cout << square( x ) << " ";
11
12 cout << endl;
13 return 0;
14 }
15
16 // Function definition
17 int square( int y )
18 {
19 return y * y;
20 }